--区域表添加是否需要二级审批标识

alter table bd_visit_area add is_appr int not null DEFAULT 0;

--创建区域负责人配置表

/*
 Navicat Premium Data Transfer

 Source Server         : 公司运服务器
 Source Server Type    : SQL Server
 Source Server Version : 13005026
 Source Host           : www.shanghaibuda.com:1433
 Source Catalog        : scm_main_sfl_visit_dev
 Source Schema         : dbo

 Target Server Type    : SQL Server
 Target Server Version : 13005026
 File Encoding         : 65001

 Date: 13/10/2020 10:55:16
*/


-- ----------------------------
-- Table structure for bd_visit_area_principal_config
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[bd_visit_area_principal_config]') AND type IN ('U'))
	DROP TABLE [dbo].[bd_visit_area_principal_config]
GO

CREATE TABLE [dbo].[bd_visit_area_principal_config] (
  [id] int  NOT NULL IDENTITY(1,1),
  [area_id] int  NOT NULL,
  [user_serial] bigint  NOT NULL,
  [create_time] datetime DEFAULT (getdate()) NOT NULL
)
GO

ALTER TABLE [dbo].[bd_visit_area_principal_config] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键',
'SCHEMA', N'dbo',
'TABLE', N'bd_visit_area_principal_config',
'COLUMN', N'id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'区域ID',
'SCHEMA', N'dbo',
'TABLE', N'bd_visit_area_principal_config',
'COLUMN', N'area_id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'区域负责人id',
'SCHEMA', N'dbo',
'TABLE', N'bd_visit_area_principal_config',
'COLUMN', N'user_serial'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'bd_visit_area_principal_config',
'COLUMN', N'create_time'
GO


-- ----------------------------
-- Primary Key structure for table bd_visit_area_principal_config
-- ----------------------------
ALTER TABLE [dbo].[bd_visit_area_principal_config] ADD CONSTRAINT [PK__bd_visit__3213E83FD1657E26] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

